package labox.innovation.gameserver.network.clientpackets;

import labox.innovation.gameserver.datatables.SkillTable;
import labox.innovation.gameserver.model.L2Skill;
import labox.innovation.gameserver.network.serverpackets.SkillInfo;

/**
 * 查看技能描述协议
 * @author zjj
 *
 */
public class RequestSkillInfo extends L2GameClientPacket {

	private static final String RequestSkillInfo = "[C] 0x32 RequestSkillInfo";

	private int _skillId; //技能id

	private int _lvl; //技能等级

	@Override
	public String getType() {
		return RequestSkillInfo;
	}

	@Override
	protected void readImpl() {
		_skillId = readInt();
		_lvl = readByte();
		if (_lvl == -1 || _lvl == 0) {
			_lvl = 1;
		}

	}

	@Override
	protected void runImpl() {
		// TODO Auto-generated method stub
		L2Skill sk = SkillTable.getInstance().getInfo(_skillId, _lvl);
		if (sk == null) {
			return;
		}
		boolean isLean = false;
		if( _lvl <= getClient().getActiveChar().getSkillLevel(_skillId)  )
		{
			isLean = true;
		}

		sendPacket(new SkillInfo(sk,isLean));

	}

}
